﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Spotted.WebApi.Extensions;

namespace Spotted.WebApi.Tests.ExtensionMethodTests
{
    [TestClass]
    public class StringExtensionTests
    {
        [TestMethod]
        public void parsing_valid_controller_type_name_returns_unaltered_controller_name()
        {
            const string controllerTypeName = "MyController";
            var controllerName = controllerTypeName.AsControllerName();

            Assert.AreEqual("My", controllerName);
        }

        [TestMethod]
        public void parse_controller_type_name_without_altering_case()
        {
            const string controllerTypeName = "mycontroller";
            var controllerName = controllerTypeName.AsControllerName();

            Assert.AreEqual("my", controllerName);
        }

        [TestMethod]
        public void parsing_non_controller_type_name_returns_null_string()
        {
            const string typeName = "mytype";
            var controllerName = typeName.AsControllerName();

            Assert.AreEqual(null, controllerName);
        }
    }
}
